﻿using Application.AppService.HFAppService;
using Application.AppService.MCAppService;
using AutoMapper;
using Domain;
using Domain.Entity;
using Microsoft.AspNetCore.Mvc;

namespace UI.Controllers.Transfer_management_调动管理_
{
	public class RegisterMCController : Controller
	{
		private readonly IMCAppService mCAppService;
		private readonly IMapper mapper;
		private readonly IHFAppService hFAppService;

		public RegisterMCController(IMCAppService mCAppService, IMapper mapper,IHFAppService hFAppService)
		{

			this.mCAppService = mCAppService;
			this.mapper = mapper;
			this.hFAppService = hFAppService;
		}
		public IActionResult Index()
		{
			return View();
		}
		public IActionResult Index1()
		{
			return View();
		}
		public IActionResult Index2()
		{
			return View();
		}
		public IActionResult MCFY(string firstKindName, string secondKindName, string thirdKindName, DateTime startDate, DateTime endDate, int page, int pageSize)
		{
			MCFenYe mCFenYe = mCAppService.DataMC(firstKindName, secondKindName, thirdKindName, startDate, endDate, page, pageSize);
			return Json(mCFenYe);
		}
		
		public async Task<IActionResult> UpdateMC(MCUpdateDto mCUpdateDto )
		{
			MC  mC= mapper.Map<MC>(mCUpdateDto);
			bool i = await mCAppService.UpdateMC(mC);
			return Json(i);
		}
		
		public IActionResult HFFY(string firstKindName, string secondKindName, string thirdKindName, DateTime startDate, DateTime endDate, int page, int pageSize)
		{
			HFFenYE hFFenYe = hFAppService.HFfenye(firstKindName, secondKindName, thirdKindName, startDate, endDate, page, pageSize);
			return Json(hFFenYe);
		}

		public async Task<IActionResult> AddMC(MC mC)
		{
			bool i = await mCAppService.AddMc(mC);
			return Json(i);
		}
	}
}
